package com.leo;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.HibernateTransactionManager;

import com.leo.dao.Dao;
import com.leo.entity.StuUid;
import com.leo.entity.User;

public class Test {
	static void test(String ... args){
		System.out.println(args.getClass().getName());		
	}
	public static void main(String[] args) {
		test(new String[]{"1","2","3"});
		ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
		org.springframework.orm.hibernate3.HibernateTransactionManager txm = (HibernateTransactionManager) ac.getBean("txManager");
		txm.getSessionFactory().getCurrentSession().beginTransaction();
		Dao dao = (Dao) ac.getBean("dao");
		List<User> list = dao.findAll(User.class, null, null);
		for(User u: list){
			List<StuUid> uid = u.getStuUids();
			//System.out.println(uid.size());
		}
		txm.getSessionFactory().getCurrentSession().getTransaction().commit();
	}
}
